Skip to content

Conversation

@SYM01
Copy link
Collaborator

@SYM01 SYM01 commented Dec 7, 2025

Now the extension supports auto detection of the profile being used for the current tab.

But due to the limitations of the modern browsers, this detection might not always accurate. The limitations are:

  • There is no way for Chrome extension to interact with pac script
  • For a domain, there is no way for Chrome extension to resolve DNS

SYM01 and others added 23 commits October 21, 2024 01:47
Bumps [nanoid](https://github.com/ai/nanoid) from 3.3.7 to 3.3.8.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](ai/nanoid@3.3.7...3.3.8)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* fix 401 issue (#22)

* enablle github action on develop branch
* Adapt firefox
* support firefore auto publish
* support firefox, and optimized UX
* [i18n] Translate messages.json in pt_BR

100% reviewed source file: 'messages.json'
on 'pt_BR'.

* [i18n] Translate messages.json in zh_CN

100% reviewed source file: 'messages.json'
on 'zh_CN'.

* [i18n] Translate messages.json in zh_TW

100% reviewed source file: 'messages.json'
on 'zh_TW'.

* [i18n] Translate messages.json in pt_BR

100% reviewed source file: 'messages.json'
on 'pt_BR'.

* update English i18n msg

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
Co-authored-by: SYM01 <33443792+SYM01@users.noreply.github.com>
* implemented an utility to export/import settings
* [i18n] Translate messages.json in pt_BR

100% reviewed source file: 'messages.json'
on 'pt_BR'.

* [i18n] Translate messages.json in zh_TW

100% reviewed source file: 'messages.json'
on 'zh_TW'.

* [i18n] Translate messages.json in zh_CN

100% reviewed source file: 'messages.json'
on 'zh_CN'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
* [WIP] support chrome auto deploy

* finalize Chrome auto deploy

* npm audit fix

* npm audit fix
* minor bug fixed

* improve UX and close #28

* use the same CIDR validator as PAC script
* [i18n] Translate messages.json in pt_BR

100% reviewed source file: 'messages.json'
on 'pt_BR'.

* [i18n] Translate messages.json in zh_TW

100% reviewed source file: 'messages.json'
on 'zh_TW'.

* [i18n] Translate messages.json in zh_CN

100% reviewed source file: 'messages.json'
on 'zh_CN'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
* update deps

* fix the auth issue in auto switch profiles

* fix typo
* [WIP] Reflect current profile when using auto profile (#42)

* Show detected profile in the popup

* simplify test cases
@gemini-code-assist
Copy link

Summary of Changes

Hello @SYM01, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request delivers a significant enhancement by enabling automatic detection and display of the proxy profile currently in use for each browser tab, particularly when 'Auto Profiles' are active. This feature aims to provide users with immediate feedback on their proxy configuration, improving transparency and control. The implementation required extensive modifications to the extension's core architecture, including new browser API integrations, a dedicated UI component for displaying detection results, and robust backend logic to accurately identify the active profile. Additionally, the project's dependencies have been updated to ensure stability and leverage the latest improvements.

Highlights

  • Auto Profile Detection: Introduced a new feature to automatically detect and display the active proxy profile for the current browser tab, especially for 'Auto Profiles'.
  • UI Enhancements: Added a new UI component (AutoModeActionBar) to the popup page to show the detected profile for the active tab, improving user awareness.
  • Adapter Layer Refactoring: The browser adapter layer (chrome.ts, firefox.ts, web.ts) has been extended to support tab-specific badge updates, retrieve the active tab, and handle message passing between background and foreground scripts.
  • New Services for Logic: Implemented new services (ProfileAuthProvider, WebRequestStatsService, pacSimulator) to manage the complex logic of determining the active profile based on web requests, handling authentication, and simulating PAC script functions.
  • Manifest Permissions & Dependencies: Updated manifest.json to include the activeTab permission, and numerous project dependencies have been upgraded to their latest versions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant new feature: automatic profile detection for 'Auto Switch' mode. This is a substantial change that touches many parts of the extension, from the background script and browser adapters to new UI components and services. The implementation includes a PAC script simulator to determine which profile is active for a given tab, which is a clever way to work around browser limitations. The code is generally well-structured and is accompanied by a good set of new unit tests for the complex logic.

My review has identified a couple of critical issues that need to be addressed, particularly one that will break proxy authentication on Firefox and another bug in the profile detection logic. I've also pointed out some medium-severity issues, such as debug console.log statements that should be removed and a large dependency update that would be better handled in a separate pull request.

Overall, this is a great addition to the extension's functionality. Once the critical issues are resolved, this will be a solid contribution.

Comment on lines 115 to 119
browser.webRequest.onAuthRequired.addListener(
callback,
callback as any,
{ urls: ["<all_urls>"] },
["asyncBlocking"]
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The implementation of onWebRequestAuthRequired for Firefox is incorrect. The browser.webRequest.onAuthRequired listener in Firefox requires a callback that returns a Promise<BlockingResponse>. The current implementation casts the callback to any, but the actual callback provided from background.ts is designed for Chrome's API and uses an asyncCallback argument instead of returning a promise. This will cause proxy authentication to fail on Firefox.

You need to wrap the callback in a new function that returns a Promise.

    browser.webRequest.onAuthRequired.addListener(
      (details) =>
        new Promise((resolve) => {
          callback(details, (response) => resolve(response));
        }),
      { urls: ["<all_urls>"] },
      ["asyncBlocking"]
    );

Comment on lines +237 to +241
const ret = await profile.findProfileForAutoProfileRule(
url,
rule,
profile
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

findProfileForAutoProfileRule is a private method of ProfileConverter. You are attempting to call it on profile, which is a different instance of ProfileConverter representing a sub-profile. This is incorrect as the method is part of the current instance's context. It should be called on this.

Suggested change
const ret = await profile.findProfileForAutoProfileRule(
url,
rule,
profile
);
const ret = await this.findProfileForAutoProfileRule(
url,
rule,
profile
);

Comment on lines 19 to 50
"dependencies": {
"@highlightjs/vue-plugin": "^2.1.0",
"@sentry/vue": "^8.51.0",
"@vueuse/core": "^12.4.0",
"acorn": "^8.14.0",
"@sentry/vue": "^10.29.0",
"@typescript/native-preview": "^7.0.0-dev.20251205.1",
"@vueuse/core": "^14.1.0",
"acorn": "^8.15.0",
"escodegen": "^2.1.0",
"espree": "^10.3.0",
"espree": "^11.0.0",
"io-ts": "^2.2.22",
"ipaddr.js": "^2.2.0",
"vue": "^3.5.13",
"vue-router": "^4.5.0"
"ipaddr.js": "^2.3.0",
"vue": "^3.5.25",
"vue-router": "^4.6.3"
},
"devDependencies": {
"@arco-design/web-vue": "^2.56.3",
"@sentry/vite-plugin": "^3.0.0",
"@types/chrome": "^0.0.266",
"@arco-design/web-vue": "^2.57.0",
"@sentry/vite-plugin": "^4.6.1",
"@types/chrome": "^0.1.32",
"@types/escodegen": "^0.0.10",
"@types/espree": "^10.1.0",
"@types/firefox-webext-browser": "^120.0.4",
"@types/node": "^22.10.6",
"@vitejs/plugin-vue": "^5.2.1",
"@vitest/coverage-v8": "^3.0.6",
"rollup-plugin-visualizer": "^5.14.0",
"sass-embedded": "^1.83.3",
"typescript": "^5.7.3",
"unplugin-auto-import": "^19.0.0",
"unplugin-vue-components": "^28.0.0",
"vite": "^6.1.0",
"vitest": "^3.0.6",
"vue-tsc": "^2.2.2"
"@types/firefox-webext-browser": "^143.0.0",
"@types/node": "^24.10.1",
"@vitejs/plugin-vue": "^6.0.2",
"@vitest/coverage-v8": "^4.0.15",
"rollup-plugin-visualizer": "^6.0.5",
"sass-embedded": "^1.93.3",
"typescript": "^5.9.3",
"unplugin-auto-import": "^20.3.0",
"unplugin-vue-components": "^30.0.0",
"vite": "^7.2.6",
"vitest": "^4.0.15",
"vue-tsc": "^3.1.6"
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This PR includes a large number of dependency updates, with several major version bumps. It's generally better to handle dependency upgrades in a separate PR from feature work. This isolates any potential breaking changes or regressions from the dependency updates, making them easier to identify and fix.

// this.stats.addFailedRequest(details);
// TODO: update indicator
const proxySetting = await getCurrentProxySetting();
console.log("onResponseStarted", details);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This console.log statement appears to be for debugging. It should be removed or replaced with a conditional log to avoid excessive output in the production environment.

Comment on lines +22 to +44
// mocking
// tabStats.value = {
// failedRequests: [],
// currentProfile: {
// profile: {
// profileID: "profile1",
// profileName: "Profile 1",
// proxyType: "proxy",
// color: "#000000",
// proxyRules: {
// default: {
// host: "127.0.0.1",
// port: 8080,
// },
// bypassList: [],
// },
// },
// isConfident: true,
// },
// tabID: props.currentTab.id,
// };
// console.log(tabStats.value);
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This commented-out block of code appears to be for mocking during development. It should be removed to keep the production code clean.

return {
validator: async (value, cb) => {
validator: async (value: string, cb: (message?: string) => void) => {
console.log("test");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This console.log statement appears to be for debugging and should be removed from the final code.

@SYM01 SYM01 merged commit ba26599 into main Dec 7, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants